import React, { Component } from 'react';
import Editor from '../../component/editor/editor';
import {Link} from 'react-router-dom'

import './article_edit.css'
import NewWenji from '../../component/editor/new_wenji';

class ArticleEdit extends Component {

    state={
        title:'你大爷',
        content:'<p>我干你老母，瘪三</p>',
        corpus:[
            {id:1,name:'你大爷'},
            {id:2,name:'八格牙路的'}
        ]
    }

    editorSaveHandle=(title, content)=>{
        this.setState({title, content})
        console.log(title, content)
    }

    editorPublishHandle=()=>{
        console.log('发布中')
    }

    render() {
        return (
            <div className="article_edit">
                <div className="wenji">
                    <Link to="/" className="back_home">回到首页</Link>
                    <NewWenji corpus={this.state.corpus} />
                 </div>
                 <div className="mulu">
                 
                 </div>
                 <div className="editor">
                 <Editor title={this.state.title} content={this.state.content} onSave={this.editorSaveHandle} onPublish={this.editorPublishHandle} />
                 </div>
             </div>
        );
    }
}

export default ArticleEdit